<template>
  <detailbox title="查看" @leftclick="close">
    <div slot="right" class="flex_item flex_between">
      <div class="warn_f gosign f12" v-if="detail.processStatus == 0 && detail.createUser == userInfo.user_id">请前往APP端，进行签名操作</div>
      <div v-else-if="detail.processStatus == 6 || detail.processStatus == 4 || detail.processStatus == 5" class="error error_f f12 ml10 p5">
        <i class="f14 el-icon-error"></i>
        审核未通过:
        <span class="ml30"> {{ checkItem.type == 1 ? '审核人:' : checkItem.type == 2 ? '评审人:' : checkItem.type == 4 ? '批准人:' : '' }} {{ checkItem.createUserName }} </span>
        <span class="ml30">未通过原因: {{ checkItem.content }}</span>
      </div>
      <div v-else></div>
      <div class="">
        <el-button type="primary" size="small" plain @click="openDialg('print')">打印</el-button>
        <el-button type="primary" size="small" plain @click="openDialg('showhistory')">审批历史详情</el-button>
      </div>
    </div>
    <el-row class="mt10">
      <el-col :span="12">
        <basic-container>
          <div class="main_title success_f"><b>文件信息</b></div>
          <el-divider></el-divider>
          <div class="mb20">
            <span class="index_num success_bg">1</span>
            <b class="f14">文件属性</b>
          </div>

          <table class="table1 owntable mb20 tableLayout" border="0" cellspacing="0" cellpadding="1" style="width: 100%">
            <tr>
              <td width="100">文件名称</td>
              <td>{{ detail.name }}</td>
              <td width="100">文件编号</td>
              <td>{{ detail.fileNumber }}</td>
              <td width="100">文件版本号</td>
              <td>{{ detail.versionNumber }}</td>
            </tr>
            <tr>
              <td>文件控制状态</td>
              <td>{{ detail.controlStatus == '0' ? '受控' : '非受控' }}</td>
              <td>内部/外来文件</td>
              <td>{{ detail.fileSource == '0' ? '内部文件' : '外来文件' }}</td>
              <td>编制部门</td>
              <td>{{ detail.createDeptName }}</td>
            </tr>
            <tr>
              <td>文件生效日期</td>
              <td>{{ detail.beginTime || '-' }}</td>
              <td>现行/作废状态</td>
              <td colspan="3">{{ detail.invalidStatus >= 0 ? invalidStatusList[detail.invalidStatus] : '-' }}</td>
            </tr>
            <tr>
              <td>文件哈希值</td>
              <td colspan="5" class="main_co pointer">
                <el-tooltip effect="dark" content="点击即可复制哈希值" placement="top">
                  <span class="pointer main" @click="onCopy(detail.hashValue)">{{ detail.hashValue }}</span>
                </el-tooltip>
              </td>
            </tr>
          </table>
          <table class="owntable mb20 table1" border="0" cellspacing="0" cellpadding="1" style="width: 100%" v-if="detail.isUpgrade">
            <tr>
              <td width="100">升版原因</td>
              <td class="white_bg">{{ detail.reason }}</td>
            </tr>
          </table>

          <table class="owntable mb20 table1" border="0" cellspacing="0" cellpadding="1" style="width: 100%">
            <tr>
              <td width="100">页码数量</td>
              <td class="white_bg">{{ detail.pageCount }}</td>
            </tr>
          </table>

          <file-globa :detail="detail" type="4"></file-globa>
        </basic-container>
      </el-col>
      <el-col :span="12"><process-record-file :guifanFilesProcessRecordList="guifanFilesProcessRecordList" :shenheNum="shenheNum"></process-record-file></el-col>
    </el-row>
    <steps ref="steps"></steps>
    <showhistory ref="showhistory" type="1" :guifanFilesProcessRecordList="guifanFilesProcessRecordList"></showhistory>
    <print ref="print" type="1" :detail="detail"></print>
  </detailbox>
</template>

<script>
import { getguifanDetail } from '@/api/myapi/tixiwenjian'
export default {
  props: {
    detailId: '',
  },
  data() {
    return {
      system: 'systemchengxufilesprocess',
      radio: '',
      checked: false,
      showpreview: false,
      tableData: [],
      useTemp: false,
      form: {},
      options: [],
      guifanFilesProcessRecordList: [],
      detail: {},
      shenheNum: 0,
    }
  },
  mounted() {
    this.getDetail()
  },
  methods: {
    close() {
      this.$emit('close')
    },
    getDetail() {
      getguifanDetail(
        {
          id: this.detailId,
        },
        this.system
      ).then(({ data }) => {
        if (data.success) {
          this.detail = data.data
          this.shenheNum = data.data.chengxuFilesProcessRecordList.length
          this.guifanFilesProcessRecordList = data.data.chengxuFilesProcessRecordList
          this.checkItem = this.guifanFilesProcessRecordList.find((item) => item.checkStatus == 2)
        }
      })
    },
  },
}
</script>

<style lang="scss">
.active {
  background-color: #e6f1fc !important;
  color: #126bc9;
}
</style>
